<basics2:ChildWindow 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:System="clr-namespace:System;assembly=mscorlib"
    xmlns:basics="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
    xmlns:basics2="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
    xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit" 
    xmlns:layoutToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Layout.Toolkit"
    xmlns:inputToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"
    xmlns:Rawr="clr-namespace:Rawr;assembly=Rawr.Base"
    xmlns:local="clr-namespace:Rawr.UI"
    mc:Ignorable="d"
    x:Class="Rawr.UI.ItemEditor"
    Title="Item Editor"
    Width="800" Height="600">
    
    <basics2:ChildWindow.Resources>
        <local:FactionConverter x:Key="FactionConverter" />
    </basics2:ChildWindow.Resources>
    
    <basics2:ChildWindow.DataContext>
        <Rawr:Item/>
    </basics2:ChildWindow.DataContext>
    
    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="528" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        
        <toolkit:WrapPanel Grid.Row="0" Grid.Column="0" Orientation="Vertical">
            <local:GroupBox Margin="2,0" Width="260">
                <local:GroupBox.Header>
                    <TextBlock Text="Basics" FontWeight="Bold"/>
                </local:GroupBox.Header>
                <Grid Margin="0,-6,0,0">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="150"/>
                    </Grid.ColumnDefinitions>
                    
                    <TextBlock x:Name="LB_Name" Text="Name:"  HorizontalAlignment="Right" VerticalAlignment="Center" Margin="2" Grid.Row="1" />
                    <TextBox x:Name="NameText" Grid.Column="1" Text="{Binding Mode=OneWay, Path=Name}"  HorizontalAlignment="Stretch" VerticalAlignment="Center" Margin="2" Grid.Row="1" />
                    <TextBlock x:Name="LB_SetName" Text="Set Name:" Grid.Row="2" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="2"/>
                    <TextBox x:Name="SetNameText" Margin="2" Grid.Column="1" Text="{Binding Mode=OneWay, Path=SetName}" Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Stretch" />
                    <TextBlock x:Name="LB_iLevel" HorizontalAlignment="Right" Text="Item Level:" Grid.Row="3" VerticalAlignment="Center" Margin="2"/>
                    <inputToolkit:NumericUpDown x:Name="IlvlNum" HorizontalAlignment="Left" Margin="2" Grid.Column="1" Grid.Row="3" VerticalAlignment="Center" Height="22" Width="60" Maximum="500" />
                    <TextBlock x:Name="LB_Id" Text="ID:" VerticalAlignment="Center" Grid.Row="4" HorizontalAlignment="Right" Margin="2"/>
                    <inputToolkit:NumericUpDown x:Name="IdNum" Height="22" HorizontalAlignment="Left" Margin="2,2,0,2" VerticalAlignment="Center" Grid.Column="1" Grid.Row="4" Width="60" Maximum="100000" Value="{Binding Mode=OneWay, Path=Id}"/>
                    <TextBlock x:Name="LB_Icon" Text="Icon:" TextWrapping="Wrap" HorizontalAlignment="Right" Grid.Row="5" VerticalAlignment="Center" Margin="2"/>
                    <TextBox x:Name="IconPathText" Margin="2,2,0,2" Grid.Column="1" Text="{Binding Mode=OneWay, Path=IconPath}" Grid.Row="5" VerticalAlignment="Center" HorizontalAlignment="Stretch" />
                    <TextBlock x:Name="LB_Type" HorizontalAlignment="Right" Text="Type:" Grid.Row="6" VerticalAlignment="Center" Margin="2"/>
                    <ComboBox x:Name="TypeCombo" Margin="2,2,0,2" Grid.Column="1" Grid.Row="6" VerticalAlignment="Center" HorizontalAlignment="Stretch" />
                    <TextBlock x:Name="LB_Quality" Text="Quality:" Grid.Row="7" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="2"/>
                    <ComboBox x:Name="QualityCombo" Margin="2,2,0,2" Grid.Column="1"  Grid.Row="7" VerticalAlignment="Center" HorizontalAlignment="Stretch" />
                    <TextBlock x:Name="LB_Slot" Text="Slot:" Grid.Row="8" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="2"/>
                    <ComboBox x:Name="SlotCombo" Margin="2,2,0,2" Grid.Column="1" Grid.Row="8" VerticalAlignment="Center" HorizontalAlignment="Stretch" />
                    <TextBlock x:Name="LB_Bind" Text="Bind Type:" Grid.Row="9" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="2"/>
                    <ComboBox x:Name="BindCombo" Margin="2,2,0,2" Grid.Column="1" Grid.Row="9" VerticalAlignment="Center" HorizontalAlignment="Stretch">
                        <System:String>None</System:String>
                        <System:String>BoP</System:String>
                        <System:String>BoE</System:String>
                        <System:String>BoA</System:String>
                        <System:String>BoU</System:String>
                    </ComboBox>
                    <TextBlock x:Name="LB_Cost" Text="Cost:" TextWrapping="Wrap" HorizontalAlignment="Right" Grid.Row="10" VerticalAlignment="Center" Margin="2"/>
                    <inputToolkit:NumericUpDown x:Name="CostText" Margin="2,2,0,2" Grid.Column="1" Value="{Binding Mode=OneWay, Path=Cost}" Grid.Row="10" VerticalAlignment="Center" HorizontalAlignment="Left" Width="60" Maximum="100000" />
                    <TextBlock x:Name="LB_Unique" VerticalAlignment="Center" Text="Unique:" Grid.Row="11" HorizontalAlignment="Right" Margin="2"/>
                    <CheckBox x:Name="UniqueCheck" HorizontalAlignment="Left" Margin="2" VerticalAlignment="Center" Grid.Column="1" Grid.Row="11" IsChecked="{Binding Mode=OneWay, Path=Unique}"/>
                </Grid>
            </local:GroupBox>
            <local:GroupBox Margin="2,0" Width="260">
                <local:GroupBox.Header>
                    <TextBlock Text="Sockets" FontWeight="Bold"/>
                </local:GroupBox.Header>
                <Grid Margin="0,-6,0,0">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="150"/>
                    </Grid.ColumnDefinitions>
                    
                    <TextBlock Text="Socket 1:" Grid.Row="0" Grid.Column="0" Margin="2" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                    <ComboBox x:Name="Gem1Combo" Grid.Row="0" Grid.Column="1" Margin="2" VerticalAlignment="Center" HorizontalAlignment="Stretch">
                        <ComboBoxItem Content="None"/>
                        <ComboBoxItem Content="Meta"/>
                        <ComboBoxItem Content="Red"/>
                        <ComboBoxItem Content="Yellow"/>
                        <ComboBoxItem Content="Blue"/>
                        <ComboBoxItem Content="Cogwheel"/>
                        <ComboBoxItem Content="Hydraulic"/>
                        <ComboBoxItem Content="Prismatic"/>
                    </ComboBox>
                    <TextBlock Text="Socket 2:" Grid.Row="1" Grid.Column="0" Margin="2" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                    <ComboBox x:Name="Gem2Combo" Grid.Row="1" Grid.Column="1" Margin="2" VerticalAlignment="Center" HorizontalAlignment="Stretch">
                        <ComboBoxItem Content="None"/>
                        <ComboBoxItem Content="Meta"/>
                        <ComboBoxItem Content="Red"/>
                        <ComboBoxItem Content="Yellow"/>
                        <ComboBoxItem Content="Blue"/>
                        <ComboBoxItem Content="Cogwheel"/>
                        <ComboBoxItem Content="Hydraulic"/>
                        <ComboBoxItem Content="Prismatic"/>
                    </ComboBox>
                    <TextBlock Text="Socket 3:" Grid.Row="2" Grid.Column="0" Margin="2" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                    <ComboBox x:Name="Gem3Combo" Grid.Row="2" Grid.Column="1" Margin="2" VerticalAlignment="Center" HorizontalAlignment="Stretch">
                        <ComboBoxItem Content="None"/>
                        <ComboBoxItem Content="Meta"/>
                        <ComboBoxItem Content="Red"/>
                        <ComboBoxItem Content="Yellow"/>
                        <ComboBoxItem Content="Blue"/>
                        <ComboBoxItem Content="Cogwheel"/>
                        <ComboBoxItem Content="Hydraulic"/>
                        <ComboBoxItem Content="Prismatic"/>
                    </ComboBox>
                    <TextBlock Text="Socket Bonus:" Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" Margin="0" VerticalAlignment="Center" TextAlignment="Center" />
                    <TextBox x:Name="BonusAmount" Grid.Row="4" Grid.Column="0" Margin="2" VerticalAlignment="Center" HorizontalAlignment="Right" Width="60" Height="20"/>
                    <ComboBox x:Name="BonusStat" Grid.Row="4" Grid.Column="1" Margin="2" VerticalAlignment="Center" HorizontalAlignment="Stretch" />
                </Grid>
            </local:GroupBox>
            <local:GroupBox Margin="2,0" Width="260">
                <local:GroupBox.Header>
                    <TextBlock Text="Weapon Properties" FontWeight="Bold"/>
                </local:GroupBox.Header>
                <Grid Margin="0,-6,0,0">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="150"/>
                    </Grid.ColumnDefinitions>
                    
                    <TextBlock Text="Damage Range:" Grid.Row="0" Grid.Column="0" Margin="2" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                    <inputToolkit:NumericUpDown x:Name="MinDamageNum" Grid.Row="0" Grid.Column="1" Margin="2" VerticalAlignment="Center" HorizontalAlignment="Left" Width="60" Maximum="10000" Value="{Binding Mode=OneWay, Path=MinDamage}"/>
                    <TextBlock Text="to" Grid.Row="0" Grid.Column="1" Margin="2" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                    <inputToolkit:NumericUpDown Grid.Row="0" x:Name="MaxDamageNum" Grid.Column="1" Margin="2" VerticalAlignment="Center" HorizontalAlignment="Right" Width="60" Maximum="10000" Value="{Binding Mode=OneWay, Path=MaxDamage}"/>
                    <TextBlock Text="Speed:" Grid.Row="1" Grid.Column="0" Margin="2" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                    <inputToolkit:NumericUpDown Grid.Row="1" x:Name="SpeedNum" Grid.Column="1" Margin="2" VerticalAlignment="Center" HorizontalAlignment="Left" Width="60" Value="{Binding Mode=OneWay, Path=Speed}" Maximum="10" Increment="0.1" DecimalPlaces="1"/>
                    <TextBlock Text="Damage Type:" Grid.Row="2" Grid.Column="0" Margin="2" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                    <ComboBox x:Name="DamageTypeComboBox" Grid.Row="2" Grid.Column="1" Margin="2" VerticalAlignment="Center" HorizontalAlignment="Stretch" />
                </Grid>
            </local:GroupBox>
            <local:GroupBox Margin="2,0" Width="260">
                <local:GroupBox.Header>
                    <TextBlock Text="Item Source Locations" FontWeight="Bold"/>
                </local:GroupBox.Header>
                <Grid Margin="0,-6,0,0">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" MaxWidth="250" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>

                    <TextBlock Text="Source:"   Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="2" VerticalAlignment="Bottom" />
                    <Button Content="Edit"      Grid.Row="0" Grid.Column="2" Height="23" Margin="0" Name="BT_ItemSourceEdit" HorizontalAlignment="Right" VerticalAlignment="Top" Width="50" Click="BT_ItemSourceEdit_Click" />
                    <TextBox x:Name="TB_Source" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" TextWrapping="Wrap" Margin="2" IsEnabled="False" Height="60" FontSize="10" MaxWidth="250" />
                    <TextBlock Text="Note:" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3" Margin="2" VerticalAlignment="Bottom"/>
                    <TextBox x:Name="TB_SourceNote" Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="4" TextWrapping="Wrap" Margin="2" VerticalAlignment="Center" HorizontalAlignment="Stretch" Height="60" FontSize="10" MaxWidth="250" />
                </Grid>
            </local:GroupBox>
            <local:GroupBox Margin="2,0" Width="260">
                <local:GroupBox.Header>
                    <TextBlock Text="Restrictions" FontWeight="Bold"/>
                </local:GroupBox.Header>
                <Grid Margin="0,-6,0,0">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" MaxWidth="250" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>

                    <TextBlock Text="Required Classes" Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="3" Margin="2" HorizontalAlignment="Center" FontWeight="Bold" />
                    <CheckBox x:Name="DeathKnightCheckBox"  Content="Death Knight"  Grid.Row="6" Grid.Column="0" Margin="2"/>
                    <CheckBox x:Name="DruidCheckBox"        Content="Druid"         Grid.Row="7" Grid.Column="0" Margin="2"/>
                    <CheckBox x:Name="HunterCheckBox"       Content="Hunter"        Grid.Row="8" Grid.Column="0" Margin="2"/>
                    <CheckBox x:Name="MageCheckBox"         Content="Mage"          Grid.Row="9" Grid.Column="0" Margin="2"/>
                    <CheckBox x:Name="PaladinCheckBox"      Content="Paladin"       Grid.Row="10" Grid.Column="0" Margin="2"/>
                    <CheckBox x:Name="PriestCheckBox"       Content="Priest"        Grid.Row="6" Grid.Column="1" Margin="2"/>
                    <CheckBox x:Name="RogueCheckBox"        Content="Rogue"         Grid.Row="7" Grid.Column="1" Margin="2"/>
                    <CheckBox x:Name="ShamanCheckBox"       Content="Shaman"        Grid.Row="8" Grid.Column="1" Margin="2"/>
                    <CheckBox x:Name="WarlockCheckBox"      Content="Warlock"       Grid.Row="9" Grid.Column="1" Margin="2"/>
                    <CheckBox x:Name="WarriorCheckBox"      Content="Warrior"       Grid.Row="10" Grid.Column="1" Margin="2"/>

                    <TextBlock Text="Required Faction" Grid.Row="11" Grid.Column="0" Grid.ColumnSpan="3" Margin="2" HorizontalAlignment="Center" FontWeight="Bold" />
                    <ComboBox Name="CB_Faction" Grid.Row="12" Grid.ColumnSpan="3" Margin="2" MaxWidth="250">
                        <System:String>Neutral</System:String>
                        <System:String>Alliance</System:String>
                        <System:String>Horde</System:String>
                    </ComboBox>
                </Grid>
            </local:GroupBox>
            <Button x:Name="RandomSuffixButton" Content="Edit Random Suffixes" HorizontalAlignment="Center" Margin="4" Click="RandomSuffixButton_Click"/>
            <Button x:Name="WowheadButton" Content="Open in Wowhead" HorizontalAlignment="Center" Margin="4" Click="WowheadButton_Click"/>
        </toolkit:WrapPanel>

        <local:GroupBox Grid.Column="2">
            <local:GroupBox.Header>
                <TextBlock Text="Stats" FontWeight="Bold" />
            </local:GroupBox.Header>
            <Grid Margin="0,-5,0,0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                
                <ScrollViewer HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Column="2" Margin="4" VerticalScrollBarVisibility="Auto" Padding="2">
                    <local:StatControl x:Name="ItemStats" VerticalAlignment="Top"/>
                </ScrollViewer>
                <local:GroupBox Header="Special Effects" Margin="4,-2,4,4" Padding="2" Grid.Row="1" FontWeight="Bold">
                    <StackPanel>
                        <ComboBox x:Name="SpecialEffectList" Margin="2" Height="22" FontWeight="Normal" />
                        <toolkit:DockPanel LastChildFill="False">
                            <Button toolkit:DockPanel.Dock="Left" Content="Add" Margin="2" Width="60" Click="AddSpecial_Click" FontWeight="Normal" />
                            <Button x:Name="DeleteSpecialButton" toolkit:DockPanel.Dock="Right" Content="Delete" Margin="2" Width="60" Click="DeleteSpecialButton_Click" FontWeight="Normal" />
                            <Button x:Name="EditSpecialButton" toolkit:DockPanel.Dock="Right" Content="Edit" Margin="2" Width="60" Click="EditSpecialButton_Click" FontWeight="Normal" />
                        </toolkit:DockPanel>
                    </StackPanel>
                </local:GroupBox>
            </Grid>
        </local:GroupBox>

        <Button x:Name="DeleteButton" Content="Delete"  Margin="4,4,0,4" Grid.Row="1" Grid.Column="0" Width="75" HorizontalAlignment="Left"  VerticalAlignment="Center" Click="DeleteButton_Click" />
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Grid.Row="1" Grid.Column="2" >
            <Button x:Name="BT_Equip"  Content="Equip"  Click="EquipButton_Click"  Margin="2,4" Width="75"/>
            <Button x:Name="BT_Cancel" Content="Cancel" Click="CancelButton_Click" Margin="2,4" Width="75"/>
            <Button x:Name="BT_OK"     Content="OK"     Click="OKButton_Click"     Margin="2,4" Width="75"/>
        </StackPanel>
    </Grid>
</basics2:ChildWindow>